/*
 * Copyright (c) 2024-present HBIS Digital Technology Co.,Ltd. All rights reserved.
 */
package com.hbisdt.cet.sample.domain;

import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 学生类
 *
 * @author : 教学示例
 * @version : 1.0
 * @date : 2025-03-16 17:44
 */
@Component //用于将Student类作为Bean注入Spring容器中
@ConfigurationProperties(prefix = "student") //将配置文件中以student开头的属性注入到该类中
@Validated
public class Student {

    /**
     * 学号
     */
    private int studentId;

    /**
     * 姓名
     */
    @NotEmpty
    private String name;

    /**
     * List对象，表示学生参加的所有社团
     */
    private List<String> clubs;

    /**
     * Map对象，表示学生的联系方式（键为联系方式类型，值为联系方式详情）
     */
    private Map<String, String> contactInfo;

    /**
     * 字符串数组，表示学生的兴趣爱好
     */
    private String[] hobbies;

    /**
     * 实体类对象，表示学生正在上的课程
     */
    private Course currentCourse;

    public int getStudentId() {
        return studentId;
    }

    public void setStudentId(int studentId) {
        this.studentId = studentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<String> getClubs() {
        return clubs;
    }

    public void setClubs(List<String> clubs) {
        this.clubs = clubs;
    }

    public Map<String, String> getContactInfo() {
        return contactInfo;
    }

    public void setContactInfo(Map<String, String> contactInfo) {
        this.contactInfo = contactInfo;
    }

    public String[] getHobbies() {
        return hobbies;
    }

    public void setHobbies(String[] hobbies) {
        this.hobbies = hobbies;
    }

    public Course getCurrentCourse() {
        return currentCourse;
    }

    public void setCurrentCourse(Course currentCourse) {
        this.currentCourse = currentCourse;
    }

    @Override
    public String toString() {
        return "Student{" +
                "studentId=" + studentId +
                ", name='" + name + '\'' +
                ", clubs=" + clubs +
                ", contactInfo=" + contactInfo +
                ", hobbies=" + Arrays.toString(hobbies) +
                ", currentCourse=" + currentCourse +
                '}';
    }
}
